<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>green-管理首页</title>
<#include "common/Resources.ftl"/>
<script type="text/javascript" src="${base}/scripts/common/general.js"></script>
<style>
	body,html{ height:100%; overflow:hidden}
</style>
</head>
 
<body>
	<div id="header">
		<h1>新房系统</h1>
		<div class="selCity">
		<#if person.number?index_of('admin')&gt;1>
		   
		<#else>
		 <#if city??> 
			<a href="javascript:void(0)" class="currentCity" id="currentCity">${city}<i></i></a>
			</#if>
			 <#if cityName??> 
			<div class="cityList">
				<ul>				
				 <#list cityName as name>
					<li><a href="javascript:void(0)"  onclick="currentCity('${ctx}/login/setCity?city=${name}');">${name}</a></li>
				</#list>
				 
				</ul>
			</div>
			</#if>
		</#if>
		</div>
		<#if optCodes.ResouseMangage_UpdateDataFromERP?? || person.number?index_of('admin')&gt;1>
		<div class="fl" style="padding-top:8px;padding-left:15px">
			<a class="mini-button" href="javaScript:syncErpDatas();" id="syncErpDatas"><span
								class="mini-button-text">同步ERP数据</span>
						</a>
		</div>
		</#if>
		<div class="countInf">
			<div class="welcome">
				<a href="javascript:void(0)">${person.name}</a>
			</div>
			<div class="systemOperate">
				<a href="${ctx}/login/exit" class="logout">注销</a>
			</div>

		</div>
	</div>
	<div id="mainWraper" class="clearfix">
		<div id="leftMenu" >
		   <#if optCodes.BrokerManage?? || person.number?index_of('admin')=1>
			<div class="menuList current">
				<h2 class="modleName extendManager">
					<a href="javascript:void(0)"><i></i><span>经纪人管理</span>
					</a>
				</h2>
				<ul class="">
				     <#if optCodes.BrokerManage_Broker??>
					<li class=""><a href="#" key="${ctx}/broker/manage" onclick="clickChange('${ctx}/broker/manage',this);"><i></i>经纪人</a></li>
					</#if>
					<#if optCodes.BrokerManage_Branch??>
					<li class=""><a href="#" key="${ctx}/branch/init" onclick="clickChange('${ctx}/branch/init',this);"><i></i>店铺</a></li>
					</#if>
					<#if optCodes.BrokerManage_Company??>
					<li class=""><a href="#" key="${ctx}/company/init" onclick="clickChange('${ctx}/company/init',this);"><i></i>公司</a></li>
					</#if>
					<#if optCodes.BrokerManage_DataUpdateCheck??>
					<li class=""><a href="#" key="${ctx}/auditInfo/manage" onclick="clickChange('${ctx}/auditInfo/manage',this);"><i></i>资料修改审核</a>
					</#if>
					</li>
				</ul>
			</div>
			 </#if>
			  <#if optCodes.JoinManage?? || person.number?index_of('admin')=1>
			 <div class="menuList current">
				<h2 class="modleName extendManager">
					<a href="javascript:void(0)"><i></i><span>加盟管理</span>
					</a>
				</h2>
				<ul class="">
					<#if optCodes.JoinManage_BranchOwner??>
					<li class="first"><a href="#" key="${ctx}/joinBranchOwner/init" onclick="clickChange('${ctx}/joinBranchOwner/init',this);"><i></i>加盟店东</a></li>
					</#if>
				    <#if optCodes.JoinManage_Branch??>
					<li class="first"><a href="#" key="${ctx}/joinBranch/init" onclick="clickChange('${ctx}/joinBranch/init',this);"><i></i>加盟店铺</a></li>
				    </#if>
					 <#if optCodes.JoinManage_Broker??>
					<li class="first"><a href="#" key="${ctx}/joinBroker/init" onclick="clickChange('${ctx}/joinBroker/init',this);"><i></i>加盟经纪人</a></li>
					</li>
					</#if>
				</ul>
				<div class="menuList current">
				<h2 class="modleName planingManager">
					<a href="javascript:void(0)"><i></i><span>合同管理</span>
					</a>
				</h2>
				<ul class="">
					<#if optCodes.ContractManage_JoinContract??>
				    <li class="first"><a href="javascript:void(0)" key="${ctx}/joinContract/manage" onclick="clickChange('${ctx}/joinContract/manage',this)"><i></i>加盟合同管理</a></li>
				    </#if>
				    <#if optCodes.ContractManage_ErpOrder??>
				    <li class="first"><a href="javascript:void(0)" key="${ctx}/joinOrder/manage" onclick="clickChange('${ctx}/joinOrder/manage',this)"><i></i>端口订单</a></li>
				    </#if>
					<#if optCodes.ContractManage_ContractNo??>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/contractNum/manage" onclick="clickChange('${ctx}/contractNum/manage',this)"><i></i>合同编号管理</a></li>
				    </#if>
				</ul>
			</div>
			</div>
			 </#if>
			 <#if optCodes.ContractManage?? || person.number?index_of('admin')=1>
			<div class="menuList current">
				<h2 class="modleName planingManager">
					<a href="javascript:void(0)"><i></i><span>合同管理</span>
					</a>
				</h2>
				<ul class="">
				    <#if optCodes.ContractManage_Contract??>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/contract/manage" onclick="clickChange('${ctx}/contract/manage',this)"><i></i>合同管理</a></li>
					</#if>
					<#if optCodes.ContractManage_ContractNo??>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/contractNum/manage" onclick="clickChange('${ctx}/contractNum/manage',this)"><i></i>合同编号管理</a></li>
				    </#if>
				</ul>
			</div>
			 </#if>
			<#if optCodes.ResouseMangage?? || person.number?index_of('admin')&gt;1>
			<div class="menuList current"> 
				<h2 class="modleName spotManager">
					<a href="javascript:void(0)"><i></i><span>管理员设置 </span>
					</a>
				</h2>
				<ul class="">
				   <#if optCodes.ResouseMangage_UserManage?? || person.number?index_of('admin')&gt;1>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/person/manager" onclick="clickChange('${ctx}/person/manager',this);" ><i></i>用户及权限设置</a>
					</li>
				   </#if>
				   <#if optCodes.ResouseMangage_OrgManage?? || person.number?index_of('admin')&gt;1>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/funPermission/manager" onclick="clickChange('${ctx}/funPermission/manager',this);" ><i></i>组织岗位授权</a>
					</li>
				   </#if>
				   <#if optCodes.ResouseMangage_ComboManage?? || person.number=='wladmin'>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/comboSetup/manager" onclick="clickChange('${ctx}/comboSetup/manager',this );"><i></i>套餐设置</a></li>
					</#if>
				   <#if optCodes.ResouseMangage_JoinERPCombo?? || person.number=='jmadmin'>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/joinPackage/manager" onclick="clickChange('${ctx}/joinPackage/manager',this );"><i></i>ERP加盟套餐</a></li>
					</#if>
					<#if optCodes.ResouseMangage_JoinPortCombo?? || person.number=='jmadmin'>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/erpPackage/manager" onclick="clickChange('${ctx}/erpPackage/manager',this );"><i></i>ERP端口套餐</a></li>
					</#if>
					<#if optCodes.ResouseMangage_OperationLog?? || person.number=='wladmin'>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/operateLog/manager" onclick="clickChange('${ctx}/operateLog/manager',this);"><i></i>操作日志</a>
					</#if>
					<#if optCodes.ResouseMangage_ErrorData?? ||  person.number=='wladmin'>
					<li class="first"><a href="javascript:void(0)" key="${ctx}/brokerExceptionRecord/manager" onclick="clickChange('${ctx}/brokerExceptionRecord/manager',this);"><i></i>异常用户数据处理</a>		
				    </#if>
				</ul>
			</div>
           </#if>
		</div>
		<div id="rightContent">
			<iframe src=""
			 width="100%" height="100%" id="mainFrame"  frameborder="no"></iframe>
			<a class="arrow-toggle  arrow-toggle-exp" href="javascript:void(0)" id="expand" title="点击收起左侧菜单"></a>
		</div>
		
		
</body>
 <script>
	function clickChange(url,obj){
		$("#mainFrame").attr("src",url);
		$(".menuList ul").find("li").removeClass()
		$(obj).parent().addClass("current")
		
	}
	$(document).ready(function() {
		adjustScreen();
		onloadCheck();
		$(window).resize(function(){
			adjustScreen();
		})
		$("#expand").toggle(
			function(){
				$("#rightContent").css({"margin-left":"0px"})
				$(this).addClass("arrow-toggle-collapse").attr("title","点击展开左侧菜单")
			},
			function(){
				$("#rightContent").css({"margin-left":""})
				$(this).removeClass("arrow-toggle-collapse").attr("title","点击收起左侧菜单")
			}
		)
		
	})
	
	function onloadCheck(){
		$(".menuList ul").find("li").each(function(){
			 $(this).addClass("current");
			 $("#mainFrame").attr("src",$(this).find("a").attr("key"));
			 return false;
		});
	}
	
	function adjustScreen(){
		$('#leftMenu').css('height', $("body").height() - 42 + 'px');
		$("#mainFrame").css("height",$("body").height() - 72+"px")
	}
	
	function syncErpDatas(){
		com.green.web.general.btnLoading($("#syncErpDatas"),"start")//加上小Loading
		$.post(ctx+"/person/syncErpDatas",{},function(ret){
		  	if(ret.flag == 1){
		  		art.dialog.optTips('同步完成',3,"success");
		  		com.green.web.general.btnLoading($("#syncErpDatas"),"remove")//移除小Loading
		  	}
		});
	}
	function currentCity(url){
		$.ajax({
			type : "POST",
			url : url,			
			success : function(date) {
				var ss = $.trim(date.message);
				if (ss == 1 || ss == "1") {
					$("#currentCity").html(date.currentCityName+"<i></i>");
					$(".menuList ul").find("li").each(function(){
						if($(this).attr("class")=="current"){
							$("#mainFrame").attr("src",$(this).find("a").attr("key"));
							return false;
						}
					});
					art.dialog.optTips('您的操作已经成功', 3, "success");
				} else {
					art.dialog.optTips('操作失败，请稍后再试', 3, "failure");
				}
			}
		});
	}
</script>
</html>
